﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using EuroManager.Domain.Simulator.Engine;
using EuroManager.Domain.Simulator.Tactics;
using EuroManager.Domain.Simulator.World;

namespace EuroManager.Domain.Simulator.AI.States
{
    public class ObserveState : IState
    {
        public static readonly float TacticalLocationTolerance = 3;

        private IPlayer player;

        public ObserveState(IPlayer player)
        {
            Contract.Requires(player != null);
            
            this.player = player;
        }

        public void Execute()
        {
            MoveToTacticalLocation();
        }

        private void MoveToTacticalLocation()
        {
            if (player.DistanceTo(player.TacticalLocation) > TacticalLocationTolerance)
            {
                player.Run(player.TacticalLocation, TacticalLocationTolerance);
            }
        }
    }
}
